package top.ed333.mcplugins.configurableevents;

import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

import java.io.File;

public class ConfigManager {
    private static final File configYmlFile = new File(ConfigurableEvents.getInstance().getDataFolder(), "config.yml");
    private static YamlConfiguration config = null;

    public static void initConfig() {
        ConfigurableEvents.getInstance().saveDefaultConfig();
        ConfigurableEvents.getInstance().saveResource("handlers/example.yml", false);
        config = YamlConfiguration.loadConfiguration(configYmlFile);
    }

    public static FileConfiguration getDefaultConfig() {
        if (config != null) {
            return config;
        } else {
            return ConfigurableEvents.getInstance().getConfig();
        }
    }
}
